(function () {
  let data = {
    day365: { orders: "20,301,987", amount: "99834" },
    day90: { orders: "301,987", amount: "9834" },
    day30: { orders: "1,987", amount: "3834" },
    day1: { orders: "987", amount: "834" },
  };
//   创建点击事件
$('.order a').on('click',function(){
    nowIndex=$(this).index()
    clearInterval(t)
    let dataKey=$(this).attr('data-key')
    let dataArr=data[dataKey]
$(this).addClass('active').siblings().removeClass('active')
$('.order h4').eq(0).html(dataArr.orders)
$('.order h4').eq(1).html(dataArr.amount)
orderInterval()
})

let nowIndex = 0
let t
function orderInterval(){

   t = setInterval(()=>{
        nowIndex++
        if(nowIndex===$('.order a').length){
            nowIndex=0
        }
        $('.order a').eq(nowIndex).trigger('click')
    },1500)
}
orderInterval()
})();
